﻿using Dora.Services.AdminUser.Dto.QueryDto;
using Dora.Services.AdminUser.Dto.SaveDto;
using Dora.Services.AdminUser.Dto.ViewDto;
using Dora.Services.AdminUser.Entities;
using Dora.Tools.Utility.Const;
using Dora.Tools.Utility.Models;
using Surging.Core.Common;
using Surging.Core.CPlatform.Ioc;
using Surging.Core.CPlatform.Runtime.Server.Implementation.ServiceDiscovery.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Dora.Services.AdminUser.IApplication
{
    /// <summary>
    /// 美程用户表服务接口
    /// </summary>
    [ServiceBundle("api/" + DoraModuleName.AdminUser + "/{Service}")]
    public interface IDoraUserService : IServiceKey
    {

        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "创建")]
        Task<ResultDto<DoraUserEntity>> Create(DoraUserEntity entity);

        /// <summary>
        /// 根据Id获取一个实体对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "根据Id获取一个实体对象")]
        Task<DoraUserEntity> GetById(Guid id);

        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "分页获取数据")]
        Task<PageDataList<DoraUserListDto>> GetPageList(DoraUserQueryDto input);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "修改")]
        Task<ResultDto> Update(DoraUserEntity entity);

        /// <summary>
        /// 根据IdList获取列表
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "根据IdList获取列表")]
        Task<List<DoraUserEntity>> GetList(List<Guid> idList);

        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        [Service(Date = "2019-04-29", Director = "TTTan", Name = "获取所有")]
        Task<List<DoraUserEntity>> GetAll();

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [Service(Date = "2019-04-30", Director = "TTTan", Name = "删除")]
        Task<bool> Delete(Guid id);

        [Service(Date = "2019-04-30", Director = "TTTan", Name = "通过用户名密码登录")]
        Task<ResultDto<IdentityUserDto>> Login(string userName, string pwd, string ip, string systemKey);


        [Service(Date = "2019-02-02", Director = "TTTan", Name = "通过用户名获取员工")]
        Task<DoraUserEntity> GetByUserName(string userName);

        [Service(Date = "2019-05-27", Director = "TTTan", Name = "通过手机号获取用户信息")]
        Task<DoraUserEntity> GetByMobile(string mobile);


        [Service(Date = "2019-02-02", Director = "TTTan", Name = "修改用户密码")]
        Task<ResultDto> UpdatePassword(Guid userId, string oldPassword, string newPassword);
        
        [Service(Date = "2019-02-14", Director = "TTTan", Name = "通过员工IdList获取带角色的员工列表")]
        Task<List<DoraUserListDto>> GetListWithRoles(List<Guid> idList);

        [Service(Date = "2019-02-14", Director = "TTTan", Name = "绑定人员角色")]
        Task<int> BindDoraUserRole(List<DoraUserRoleSaveDto> list);

        [Service(Date = "2019-02-15", Director = "TTTan", Name = "重置用户密码")]
        Task<ResultDto> ResetPassword(Guid userId, string password);
        
        /// <summary>
        /// 更新员工的缓存权限
        /// </summary>
        /// <param name="employeeId"></param>
        /// <returns></returns>
        [Service(Date = "2019-02-27", Director = "TTTan", Name = "获取用户有权限的所有系统")]
        Task<bool> RefreshRedisToken(Guid userId);

        /// <summary>
        /// 获取使用这些角色的员工列表
        /// </summary>
        /// <param name="roleIdList"></param>
        /// <returns></returns>
        [Service(Date = "2019-02-27", Director = "TTTan", Name = "获取使用这些角色的员工列表")]
        Task<List<Guid>> GetIdListByRoleIdList(List<Guid> roleIdList);
        

        /// <summary>
        /// 忘记密码之重置密码
        /// </summary>
        /// <param name="mobile">手机号码</param>
        /// <param name="code">验证码</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [Service(Date = "2019-03-15", Director = "TTTan", Name = "忘记密码之重置密码")]
        Task<ResultDto> ResetPassword4Forget(string mobile, string code, string password);

        /// <summary>
        /// 用户禁用
        /// </summary>
        /// <param name="id"></param>
        /// <param name="opId"></param>
        /// <param name="opName"></param>
        /// <returns></returns>
        [Service(Date = "2019-05-06", Director = "TTTan", Name = "用户禁用")]
        Task<bool> Disable(Guid id, Guid opId, string opName);

        /// <summary>
        /// 用户启用
        /// </summary>
        /// <param name="id"></param>
        /// <param name="opId"></param>
        /// <param name="opName"></param>
        /// <returns></returns>
        [Service(Date = "2019-05-06", Director = "TTTan", Name = "用户启用")]
        Task<bool> Enable(Guid id, Guid opId, string opName);

        /// <summary>
        /// 用户冻结
        /// </summary>
        /// <param name="id"></param>
        /// <param name="opId"></param>
        /// <param name="opName"></param>
        /// <returns></returns>
        [Service(Date = "2019-05-06", Director = "TTTan", Name = "用户冻结")]
        Task<bool> Frozen(Guid id, Guid opId, string opName);

        /// <summary>
        /// 用户解冻
        /// </summary>
        /// <param name="id"></param>
        /// <param name="opId"></param>
        /// <param name="opName"></param>
        /// <returns></returns>
        [Service(Date = "2019-05-06", Director = "TTTan", Name = "用户解冻")]
        Task<bool> UnFrozen(Guid id, Guid opId, string opName);

    }
}
